package com.cloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestClientConfig {
    // 启用 默认 "LoadBalanced" 轮询规则
    @Bean(name="restTemplate")
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

    // 启用 "自定义" RibbonRuleConfig 轮询规则
    @Bean(name="restTemplate2")
    public RestTemplate getRestTemplate2() {
        return new RestTemplate();
    }
}
